﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"
    Theme="CodeCamp" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Live@Edu SSO Portal Demo</title>
    <script language="javascript" type="text/javascript">    
	function postSlt( liveLogonUrl, slt )
	{
		var tempSpan = window.document.createElement( "span" );
		var formHtml = "<form method='POST' action='" + liveLogonUrl + "' id='SLT_Form' name='SLT_Form'";
		formHtml += ">";
		formHtml += "<input type='hidden' name='slt' value='" + slt + "'>";
		formHtml += "</form>";

		tempSpan.innerHTML = formHtml;
		window.document.body.appendChild( tempSpan );
		
		var formTag = window.document.getElementById( "SLT_Form" );
		if ( !formTag )
		{
			var formTags = window.document.getElementsByTagName( "form" );
			if ( formTags )
			{
				if ( formTags.length )
				{
					for ( var index = 0; index < formTags.length; index++ )
					{
						if ( formTags[ index ].id == "SLT_Form" )
						{
							formTag = formTags[ index ];
							break;
						}
					}
				}
				else if ( formTags.id == "SLT_Form" )
				{
					formTag = formTags;
				}
			}
		}
		if ( formTag )
		{
		    formTag.submit();
		}
	}
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <h1>
            Windows Live@Edu SSO Portal Demo</h1>
        <h2>
            <asp:Label ID="LabelScenarioName" runat="server"></asp:Label></h2>
        <hr />
        <div id="oneStep">
            <h3>
                &nbsp; One-click demo</h3>
            &nbsp;
            <asp:Button ID="OneClickButton" runat="server" Text="My Mail" OnClick="OneClickButton_Click" />
            &nbsp;
            <asp:Label ID="LabelDemoTwo" runat="server" Text="Press [My Mail] button for 'one-click' redirection demo"></asp:Label>
            <h5>
                &nbsp;<asp:Label ID="LabelDemo" runat="server" Text="...or follow sequence below for step-by-step execution"></asp:Label></h5>
        </div>
        <hr />
        <div id="step1">
            <h3>
                &nbsp;Web-portal user identification</h3>
            <h5>
                &nbsp;<asp:Label ID="LabelUserIdentification" runat="server"></asp:Label>&nbsp;</h5>
            &nbsp;<asp:Button ID="Button01" runat="server" Text="Step 1" OnClick="Button01_Click" />
            <asp:Label ID="LabelPortalUser" runat="server"></asp:Label>
        </div>
        <hr />
        <div id="step2">
            <h3>
                &nbsp;Windows LiveID retrieval</h3>
            <h5>
                <asp:Label ID="LabelDomainAppend" runat="server" Text="Append Domain Name:"></asp:Label></h5>
            &nbsp;<asp:Button ID="Button02" runat="server" Text="Step 2" OnClick="Button02_Click" />&nbsp;
            <asp:Label ID="LabelWindowsLiveUser" runat="server"></asp:Label>&nbsp;
        </div>
        <hr />
        <div id="step3">
            <h3>
                &nbsp;Select the Redirect URL</h3>
            <h5>
                &nbsp;<asp:RadioButton ID="optDefault" runat="server" Checked="True" GroupName="RedirectOptions"
                    Text="Default Redirect URL" /><br />
                &nbsp;<asp:RadioButton ID="optSpaces" runat="server" GroupName="RedirectOptions"
                    Text="Spaces (http://spaces.live.com/?lc=1033)" /><br />
                &nbsp;<asp:RadioButton ID="optSkyDrive" runat="server" GroupName="RedirectOptions"
                    Text="SkyDrive (http://skydrive.live.com/home.aspx?provision=1)" />
            </h5>
        </div>
        <hr />
        <div id="step4">
            <h3>
                &nbsp;Get Short Lived Ticket from Windows Live</h3>
            &nbsp;
            <asp:Button ID="Button04" runat="server" Text="Step 4" OnClick="Button04_Click" />
            &nbsp;
            <asp:Label ID="LabelSLT" runat="server"></asp:Label>
            <br /><br />
            &nbsp;
            <asp:Label ID="LabelRedirectionTarget" runat="server" ForeColor="green"></asp:Label><br />
            &nbsp;
            <asp:Label ID="LabelErrorCode" runat="server" ForeColor="darkred" Font-Bold="true"></asp:Label>
            &nbsp;
            <asp:Label ID="LabelErrorText" runat="server" ForeColor="darkred"></asp:Label>
            <br />
            &nbsp;
            <asp:Label ID="LabelInnerErrorCode" runat="server" ForeColor="darkred" Font-Bold="true"></asp:Label>
            &nbsp;
            <asp:Label ID="LabelInnerErrorText" runat="server" ForeColor="darkred"></asp:Label>            
        </div>
        <hr />
        <div id="step5">
            <h3>
                &nbsp;User Redirection:</h3>
            <p>
                &nbsp;<asp:Button ID="Button05" runat="server" Text="Step 5" OnClick="Button05_Click" />&nbsp;
                <asp:Label ID="LabeRedirect" runat="server"></asp:Label></p>
        </div>
    </form>
</body>
</html>
